package com.zzedu.enmuns;

import java.util.Arrays;

public enum DictEnums {
    /**
     * 状态字典Key
     */
    STATE("state","状态字典Key"),
    /**
     * 状态字典Key
     */
    SYS_USER_SEX("sys_user_sex","性别字典Key"),
    ;

    DictEnums(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    private String code;

    private String desc;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }


    public static DictEnums getCode(String code) {

        return Arrays.stream(DictEnums.values()).filter(e -> e.getCode().equals(code) ).findFirst().orElse(null);
    }
}
